<template>
  <div>
    <Button @click="showHistory">查看历史</Button>
    <Button @click="notify">知会</Button>
    <Button @click="countUserSign">加签</Button>
    <Button @click="subtractUserSign">减签</Button>
    <Button @click="testApprove">测试审批</Button>
    <FlowPass flow-user-task-id="1778916567995469826" ref="FlowPass"/>

    <Button @click="widthdraw">主动撤回</Button>

    <Button @click="startProcess">测试发起</Button>

    <FlowModelEditor ref="FlowModelEditor"  :request="request"/>
  </div>
</template>
<script>
import {Button, ConfigProvider, Modal} from 'ant-design-vue';
import FlowPreview from './components/flow/FlowPreview/FlowPreview.vue';
import UserTaskConfigModal from './components/UserTaskConfigModal/UserTaskConfigModal.vue';
import zhCN from 'ant-design-vue/lib/locale-provider/zh_CN';
import FlowPass from './components/flow/flowPass/FlowPass';
import FlowRequest from '@/request/FlowRequest';
import FormFlowHistory from '@/components/flow/FormFlowHistory/FormFlowHistory.vue';
import FormFlowHistoryModal from '@/components/flow/FormFlowHistory/FormFlowHistoryModal.vue';
import FormulaEditorModal from '@/components/FormulaEditor/FormulaEditorModal.vue';
import FlowEditor from '@/components/flow/FlowEditor/FlowEditor.vue';
import FlowModelEditor from '@/components/FlowModelEditor/FlowModelEditor.vue';

export default {
  components: {
    FlowModelEditor,
    FormFlowHistoryModal,
    FormFlowHistory,
    Button,
    FlowEditor,
    FormulaEditorModal,
    ConfigProvider,
    UserTaskConfigModal,
    FlowPreview,
    FlowPass,
    Modal,
  },
  data() {
    return {
      locale: zhCN,
      UserTaskConfigModal,
      myFlow: undefined,
      visible: true,
      request: {
        baseURL: '/h-flow',
        headers: {
          flow: 'h-flow'
        },
      }
    };
  },
  methods: {
    subtractUserSign() {
      let flowUserTaskId = '1776552775151542274';
      FlowRequest(this.request).subtractUserSign({flowUserTaskId}, () => {

      });
    },
    configFormula() {

    },
    widthdraw() {
      FlowRequest(this.request).widthdraw({processInstanceId: '1778916567659925506'}, () => {
        console.log('主动撤回成功')
      })
    },
    testApprove() {
      this.$refs.FlowPass.open()
    },
    countUserSign() {
      let flowUserTaskId = '1776263293504352258';
      FlowRequest(this.request).countUserSign({flowUserTaskId, UserTaskConfigModal}, () => {

      });
    },
    startProcess() {
      FlowRequest(this.request).preStart({formModel: {}, formTypeId: 'tangzy-test', formId: undefined}, () => {
        console.log('发起了!!')
      })
    },
    notify() {
      FlowRequest(this.request).notify({UserTaskConfigModal, flowUserTaskId: '1776067872458870785'});
    },
    showFormHistory() {

    },
    showHistory() {
      FlowRequest(this.request).showProcessHistory('1776889578932981762');
    },
  }
};
</script>
<style>
* {
  padding: 0;
  margin: 0
}
</style>
